package org.indi.graduatemanagement.entity;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableId;

import javax.validation.constraints.NotBlank;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author zcl
 * @since 2021-04-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    public User() {
    }

    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    private String password;

    private String roles;

    private String permission;

    private Integer status;

    private LocalDateTime created;

    @TableField("lastLogin")
    private LocalDateTime lastLogin;

    @NotBlank(message = "用户名不能为空")
    @TableField("userName")
    private String userName;

    public User(String password, String roles, String permission, String userName) {
        this.password = password;
        this.roles = roles;
        this.permission = permission;
        this.userName = userName;
    }

    public User(Long id, String password, String roles, String permission, Integer status, LocalDateTime created, LocalDateTime lastLogin, String userName) {
        this.id = id;
        this.password = password;
        this.roles = roles;
        this.permission = permission;
        this.status = status;
        this.created = created;
        this.lastLogin = lastLogin;
        this.userName = userName;
    }
}
